<template>
  <div>
    <ul class="pagination pagination-sm no-margin pull-right">
      <li :class="{disabled:data.isFirstPage}" @click="page = Math.max(data.prePage,1)"><a><i class="fa fa-chevron-left"></i></a></li>
      <li v-for="p in data.navigatepageNums" :key="p" :class="{active:data.pageNum == p}" @click="page = p"><a>{{p}}</a></li>
      <li @click="page = Math.max(data.nextPage,1)"><a><i class="fa fa-chevron-right"></i></a></li>
    </ul>
    <div class="pull-right" style="margin-top: 7px;margin-right: 10px;">
      {{data.startRow}}-{{data.endRow}} / {{data.total}}
    </div>
  </div>
</template>

<script>
  export default {
    name: 'BsPagination',
    props: {
      data: {
        type: Object
      },
      value: {
        type: Number
      }
    },
    data() {
      return {
        page: this.value
      };
    },
    watch: {
      page(newValue) {
        this.$emit('input', newValue);
      }
    }
  };
</script>

<style scoped lang="scss">
  .pagination {
    li {
      cursor: pointer;
    }
  }
</style>
